#pragma once

#include "transformable.h"
#include <osg\MatrixTransform>
#include <osg\ref_ptr>

struct dMass;

namespace CoreBase
{
   class ODEBodyWrap;

   class COREBASE_EXPORT Physical : public Transformable
   {
   public:
      Physical(ActorBase* owneractor,const QString& name = "Physical");
      Physical(osg::MatrixTransform& node,ActorBase* owneractor, const QString& name = "Physical" );
   protected:
      virtual ~Physical();
   public:
      void setBodyID(dBodyID bodyID);
      dBodyID getBodyID() const;
      void enableDynamics(bool enable = true);
      bool dynamicsEnabled() const;
      void setMass(const dMass* mass);
      void getMass(dMass* mass) const;
      void setMass(float mass);
      float getMass() const;
      void setCenterOfGravity(const osg::Vec3& centerOfGravity);
      void getCenterOfGravity(osg::Vec3& dest) const;
      void setInertiaTensor(const osg::Matrix& inertiaTensor);
      void getInertiaTensor(osg::Matrix& mat) const;
      virtual void prePhysicsStepUpdate();
      virtual void postPhysicsStepUpdate();
      virtual bool filterContact(dContact* /*contact*/, Transformable* /*collider*/) { return true; }
      const ODEBodyWrap* getBodyWrapper() const {return _bodyWrap.get();}
      ODEBodyWrap* getBodyWrapper() {return _bodyWrap.get();}
   private:
      void ctor();
	  osg::ref_ptr<ODEBodyWrap> _bodyWrap;
   };
}